Skip to content

add AliasAssign declarations#11846

Merged
atilaneves merged 1 commit intodlang:masterfrom
WalterBright:AliasAssign
Dec 14, 2020
Merged

add AliasAssign declarations#11846
atilaneves merged 1 commit intodlang:masterfrom
WalterBright:AliasAssign

Conversation

@WalterBright
Copy link
Member

This evolved from a conversation with Andrei when he asked "why not just allow assignment to an alias?" Why not, indeed:

template staticMap(F, T...)
{
    static if (T.length == 0)
        alias staticMap = AliasSym!();
    else
        alias staticMap = AliasSym!(F!(T[0]), staticMap!(T[0 .. T.length]));
}

becomes:

template staticMap(alias F, T...)
{
    alias A = AliasSeq!();
    static foreach (t; T)
        A = AliasSeq!(A, F!t); // what's new
    alias staticMap = A;
}

Combining this with D's already powerful features static foreach, tuple slicing and tuple concatenation we should be able to re-implement the std.meta templates using this, and eliminating the recursion and recursion's problems.

Implementing it turned out to be straightforward, once I figured out that making the A = AliasSeq!(A, F!t); an anonymous Dsymbol was the way to go. Most of the implementation is all of the boilerplate needed to add a new Dsymbol type, the actual implementation is minimal.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#11846"

@thewilsonator thewilsonator added the Review:Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org label Oct 10, 2020
@WalterBright
Copy link
Member Author

@thewilsonator I know, but most of that info is in the AliasAssign.md file, and I'll do the work for the spec PR once this is a go.

@thewilsonator
Copy link
Contributor

I'm more thinking documentation.

@WalterBright WalterBright force-pushed the AliasAssign branch 2 times, most recently from a49fcf0 to 44ba28b Compare October 10, 2020 10:19
@WalterBright
Copy link
Member Author

Buildkit heisenbug strikes again.

Building dmd | 1m 37s
-- | --
  | ~> dmd/src/bootstrap.sh
  | [boostrap] Downloading compiler http://downloads.dlang.org/releases/2.x/2.088.0/dmd.2.088.0.linux.tar.xz
  | curl: (56) Recv failure: Connection reset by peer
  | xz: (stdin): Unexpected end of input
  | tar: Unexpected EOF in archive
  | tar: Unexpected EOF in archive
  | tar: Error is not recoverable: exiting now
  | ERROR: bootstrapping failed.
  | 🚨 Error: The command exited with status 1

Can't we fix these networking failures with "if it was a networking failure, sleep for a few seconds and try again?"

@ibuclaw
Copy link
Member

ibuclaw commented Oct 10, 2020

Seems to stop just short of type functions?


---
AliasAssign:
Identifier = Type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is reassignment limited to types? What about aliases for other symbols?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because if this doesn't work, it isn't worth the effort to extend it.

@UplinkCoder
Copy link
Member

UplinkCoder commented Oct 10, 2020 via email

@UplinkCoder
Copy link
Member

This evolved from a conversation with Andrei when he asked "why not just allow assignment to an alias?"

Really?
If I recall @pbackus talked about this first. He should be credited at least.

There issue, that I have with this approach, is that I don't have proofs that guarantee this will not alter the langauge.

Type-functions are essentially a shell around this ability, because this is shaky ground.
It might be that this will work fine, but if it does that's just luck.

@pbackus
Copy link
Contributor

pbackus commented Oct 10, 2020

The changelog entry says:

Upon semantic processing, when the AliasAssign is encountered the Type in the
AliasAssign replaces the Type from the corresponding AliasDeclaration or any previous matching
AliasAssign.

How does this interact with on-demand semantic analysis of forward references? For example, what is the output of this program:

template Example()
{
    alias A = int;
    alias B = S!string;
    A value;

    struct S(T)
    {
        A = T;
    }
}


void main()
{
    import std.stdio;
    writeln(typeof(Example!().value).stringof);
}

If we're going to add declarations that depend on the order of semantic processing, the language spec should specify what that order actually is.

(Edit: added a template so that A is "an alias declaration inside a template.")

@WalterBright
Copy link
Member Author

Seems to stop just short of type functions?

Yes, that's right. If it resolves the problem, then it's a much simpler solution.

@WalterBright
Copy link
Member Author

what is the output of this program

Compile time error, because the alias assignment's immediate parent is not the same template as the alias declaration.

@WalterBright
Copy link
Member Author

If I recall @pbackus talked about this first.

If @pbackus can confirm, I'd be happy to credit him.

@WalterBright
Copy link
Member Author

@UplinkCoder please provide a link to your description of type functions, and a link to your implementation code, and I will be happy to cite them as prior work.

@pbackus
Copy link
Contributor

pbackus commented Oct 10, 2020

I proposed something similar, but not exactly the same, in a couple of recent forum threads. [1][2] I'm not overly worried about attribution, but you're welcome to cite them if you like.

[1] https://forum.dlang.org/thread/peatuezvcarhkjbsqqsv@forum.dlang.org?page=8#post-drybmowizcakksuvgraz:40forum.dlang.org
[2] https://forum.dlang.org/thread/bnmjemuzwzosvglnyzbz@forum.dlang.org?page=6#post-xsmldmqkvhnifypmopcl:40forum.dlang.org

@WalterBright
Copy link
Member Author

@pbackus Your first cite looks like the same idea to me, though with the ref addition. Thank you!

@WalterBright
Copy link
Member Author

Azure pipelines (Windows_LDC_MinGW win32-ldc):

D:\a\1\druntime>echo "[DRUNTIME] running tests..." 
"[DRUNTIME] running tests..."

D:\a\1\druntime>"D:\a\1\s\dm\path\make.exe" -f win64.mak MODEL=32mscoff "DMD=D:\a\1\s\generated\Windows\RelWithAsserts\Win32\dmd.exe" "VCDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\." "CC=C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\cl.exe " "MAKE=D:\a\1\s\dm\path\make.exe" unittest   || exit /B 3 
"D:\a\1\s\generated\Windows\RelWithAsserts\Win32\dmd.exe" -m32mscoff -conf= -O -release -dip1000 -preview=fieldwise -w -version=_MSC_VER_ -Isrc -Iimport -version=druntime_unittest -version=CoreUnittest -unittest -checkaction=context -ofunittest.exe -main src\object.d   src\core\atomic.d  src\core\attribute.d  src\core\bitop.d  src\core\checkedint.d  src\core\cpuid.d  src\core\demangle.d  src\core\exception.d  src\core\lifetime.d  src\core\math.d  src\core\memory.d  src\core\runtime.d  src\core\simd.d  src\core\time.d  src\core\vararg.d  src\core\volatile.d   src\core\gc\config.d  src\core\gc\gcinterface.d  src\core\gc\registry.d   src\core\internal\abort.d  src\core\internal\atomic.d  src\core\internal\attributes.d  src\core\internal\convert.d  src\core\internal\dassert.d  src\core\internal\destruction.d  src\core\internal\entrypoint.d  src\core\internal\execinfo.d  src\core\internal\hash.d  src\core\internal\moving.d  src\core\internal\parseoptions.d  src\core\internal\postblit.d  src\core\internal\spinlock.d  src\core\internal\string.d  src\core\internal\switch_.d  src\core\internal\traits.d  src\core\internal\utf.d  src\core\internal\lifetime.d   src\core\internal\array\appending.d  src\core\internal\array\comparison.d  src\core\internal\array\construction.d  src\core\internal\array\equality.d  src\core\internal\array\casting.d  src\core\internal\array\capacity.d  src\core\internal\array\concatenation.d  src\core\internal\array\operations.d  src\core\internal\array\utils.d   src\core\internal\elf\dl.d  src\core\internal\elf\io.d   src\core\internal\util\array.d   src\core\internal\vararg\aarch64.d  src\core\internal\vararg\sysv_x64.d   src\core\stdc\assert_.d  src\core\stdc\complex.d  src\core\stdc\config.d  src\core\stdc\ctype.d  src\core\stdc\errno.d  src\core\stdc\fenv.d  src\core\stdc\float_.d  src\core\stdc\inttypes.d  src\core\stdc\limits.d  src\core\stdc\locale.d  src\core\stdc\math.d  src\core\stdc\signal.d  src\core\stdc\stdarg.d  src\core\stdc\stddef.d  src\core\stdc\stdint.d  src\core\stdc\stdio.d  src\core\stdc\stdlib.d  src\core\stdc\string.d  src\core\stdc\tgmath.d  src\core\stdc\time.d  src\core\stdc\wchar_.d  src\core\stdc\wctype.d   src\core\stdcpp\allocator.d  src\core\stdcpp\array.d  src\core\stdcpp\exception.d  src\core\stdcpp\memory.d  src\core\stdcpp\new_.d  src\core\stdcpp\string.d  src\core\stdcpp\string_view.d  src\core\stdcpp\type_traits.d  src\core\stdcpp\utility.d  src\core\stdcpp\vector.d  src\core\stdcpp\xutility.d   src\core\sync\barrier.d  src\core\sync\condition.d  src\core\sync\config.d  src\core\sync\exception.d  src\core\sync\event.d  src\core\sync\mutex.d  src\core\sync\rwmutex.d  src\core\sync\semaphore.d   src\core\sys\bionic\err.d  src\core\sys\bionic\fcntl.d  src\core\sys\bionic\string.d  src\core\sys\bionic\unistd.d   src\core\sys\darwin\crt_externs.d  src\core\sys\darwin\dlfcn.d  src\core\sys\darwin\err.d  src\core\sys\darwin\execinfo.d  src\core\sys\darwin\pthread.d  src\core\sys\darwin\string.d  src\core\sys\darwin\mach\dyld.d  src\core\sys\darwin\mach\getsect.d  src\core\sys\darwin\mach\kern_return.d  src\core\sys\darwin\mach\loader.d  src\core\sys\darwin\mach\nlist.d  src\core\sys\darwin\mach\port.d  src\core\sys\darwin\mach\semaphore.d  src\core\sys\darwin\mach\stab.d  src\core\sys\darwin\mach\thread_act.d  src\core\sys\darwin\netinet\in_.d   src\core\sys\darwin\sys\cdefs.d  src\core\sys\darwin\sys\event.d  src\core\sys\darwin\sys\mman.d   src\core\sys\freebsd\dlfcn.d  src\core\sys\freebsd\err.d  src\core\sys\freebsd\execinfo.d  src\core\sys\freebsd\netinet\in_.d  src\core\sys\freebsd\pthread_np.d  src\core\sys\freebsd\string.d  src\core\sys\freebsd\time.d  src\core\sys\freebsd\unistd.d   src\core\sys\freebsd\sys\_bitset.d  src\core\sys\freebsd\sys\_cpuset.d  src\core\sys\freebsd\sys\cdefs.d  src\core\sys\freebsd\sys\elf_common.d  src\core\sys\freebsd\sys\elf.d  src\core\sys\freebsd\sys\elf32.d  src\core\sys\freebsd\sys\elf64.d  src\core\sys\freebsd\sys\event.d  src\core\sys\freebsd\sys\link_elf.d  src\core\sys\freebsd\sys\mman.d  src\core\sys\freebsd\sys\mount.d   src\core\sys\dragonflybsd\dlfcn.d  src\core\sys\dragonflybsd\err.d  src\core\sys\dragonflybsd\execinfo.d  src\core\sys\dragonflybsd\netinet\in_.d  src\core\sys\dragonflybsd\pthread_np.d  src\core\sys\dragonflybsd\string.d  src\core\sys\dragonflybsd\time.d   src\core\sys\dragonflybsd\sys\_bitset.d  src\core\sys\dragonflybsd\sys\_cpuset.d  src\core\sys\dragonflybsd\sys\cdefs.d  src\core\sys\dragonflybsd\sys\elf.d  src\core\sys\dragonflybsd\sys\elf32.d  src\core\sys\dragonflybsd\sys\elf64.d  src\core\sys\dragonflybsd\sys\elf_common.d  src\core\sys\dragonflybsd\sys\event.d  src\core\sys\dragonflybsd\sys\link_elf.d  src\core\sys\dragonflybsd\sys\mman.d  src\core\sys\dragonflybsd\sys\socket.d   src\core\sys\linux\config.d  src\core\sys\linux\dlfcn.d  src\core\sys\linux\elf.d  src\core\sys\linux\epoll.d  src\core\sys\linux\err.d  src\core\sys\linux\errno.d  src\core\sys\linux\execinfo.d  src\core\sys\linux\fcntl.d  src\core\sys\linux\ifaddrs.d  src\core\sys\linux\link.d  src\core\sys\linux\sched.d  src\core\sys\linux\stdio.d  src\core\sys\linux\string.d  src\core\sys\linux\termios.d  src\core\sys\linux\time.d  src\core\sys\linux\timerfd.d  src\core\sys\linux\tipc.d  src\core\sys\linux\unistd.d   src\core\sys\linux\netinet\in_.d  src\core\sys\linux\netinet\tcp.d   src\core\sys\linux\sys\auxv.d  src\core\sys\linux\sys\eventfd.d  src\core\sys\linux\sys\file.d  src\core\sys\linux\sys\inotify.d  src\core\sys\linux\sys\mman.d  src\core\sys\linux\sys\signalfd.d  src\core\sys\linux\sys\socket.d  src\core\sys\linux\sys\sysinfo.d  src\core\sys\linux\sys\xattr.d  src\core\sys\linux\sys\time.d  src\core\sys\linux\sys\prctl.d   src\core\sys\netbsd\dlfcn.d  src\core\sys\netbsd\err.d  src\core\sys\netbsd\execinfo.d  src\core\sys\netbsd\string.d  src\core\sys\netbsd\time.d   src\core\sys\netbsd\sys\elf.d  src\core\sys\netbsd\sys\elf32.d  src\core\sys\netbsd\sys\elf64.d  src\core\sys\netbsd\sys\elf_common.d  src\core\sys\netbsd\sys\event.d  src\core\sys\netbsd\sys\featuretest.d  src\core\sys\netbsd\sys\link_elf.d  src\core\sys\netbsd\sys\mman.d   src\core\sys\openbsd\dlfcn.d  src\core\sys\openbsd\err.d  src\core\sys\openbsd\string.d  src\core\sys\openbsd\time.d   src\core\sys\openbsd\sys\cdefs.d  src\core\sys\openbsd\sys\elf.d  src\core\sys\openbsd\sys\elf32.d  src\core\sys\openbsd\sys\elf64.d  src\core\sys\openbsd\sys\elf_common.d  src\core\sys\openbsd\sys\link_elf.d  src\core\sys\openbsd\sys\mman.d   src\core\sys\posix\arpa\inet.d  src\core\sys\posix\aio.d  src\core\sys\posix\config.d  src\core\sys\posix\dirent.d  src\core\sys\posix\dlfcn.d  src\core\sys\posix\fcntl.d  src\core\sys\posix\grp.d  src\core\sys\posix\iconv.d  src\core\sys\posix\inttypes.d  src\core\sys\posix\libgen.d  src\core\sys\posix\locale.d  src\core\sys\posix\mqueue.d  src\core\sys\posix\netdb.d  src\core\sys\posix\poll.d  src\core\sys\posix\pthread.d  src\core\sys\posix\pwd.d  src\core\sys\posix\sched.d  src\core\sys\posix\semaphore.d  src\core\sys\posix\setjmp.d  src\core\sys\posix\signal.d  src\core\sys\posix\spawn.d  src\core\sys\posix\stdio.d  src\core\sys\posix\stdlib.d  src\core\sys\posix\string.d  src\core\sys\posix\strings.d  src\core\sys\posix\syslog.d  src\core\sys\posix\termios.d  src\core\sys\posix\time.d  src\core\sys\posix\ucontext.d  src\core\sys\posix\unistd.d  src\core\sys\posix\utime.d   src\core\sys\posix\net\if_.d   src\core\sys\posix\netinet\in_.d  src\core\sys\posix\netinet\tcp.d   src\core\sys\posix\stdc\time.d   src\core\sys\posix\sys\filio.d  src\core\sys\posix\sys\ioccom.d  src\core\sys\posix\sys\ioctl.d  src\core\sys\posix\sys\ipc.d  src\core\sys\posix\sys\mman.d  src\core\sys\posix\sys\msg.d  src\core\sys\posix\sys\resource.d  src\core\sys\posix\sys\select.d  src\core\sys\posix\sys\shm.d  src\core\sys\posix\sys\socket.d  src\core\sys\posix\sys\stat.d  src\core\sys\posix\sys\statvfs.d  src\core\sys\posix\sys\time.d  src\core\sys\posix\sys\ttycom.d  src\core\sys\posix\sys\types.d  src\core\sys\posix\sys\uio.d  src\core\sys\posix\sys\un.d  src\core\sys\posix\sys\utsname.d  src\core\sys\posix\sys\wait.d   src\core\sys\solaris\dlfcn.d  src\core\sys\solaris\elf.d  src\core\sys\solaris\err.d  src\core\sys\solaris\execinfo.d  src\core\sys\solaris\libelf.d  src\core\sys\solaris\link.d  src\core\sys\solaris\time.d  src\core\sys\solaris\sys\elf.d  src\core\sys\solaris\sys\elf_386.d  src\core\sys\solaris\sys\elf_amd64.d  src\core\sys\solaris\sys\elf_notes.d  src\core\sys\solaris\sys\elf_SPARC.d  src\core\sys\solaris\sys\elftypes.d  src\core\sys\solaris\sys\link.d  src\core\sys\solaris\sys\priocntl.d  src\core\sys\solaris\sys\procset.d  src\core\sys\solaris\sys\types.d   src\core\sys\windows\accctrl.d  src\core\sys\windows\aclapi.d  src\core\sys\windows\aclui.d  src\core\sys\windows\basetsd.d  src\core\sys\windows\basetyps.d  src\core\sys\windows\cderr.d  src\core\sys\windows\cguid.d  src\core\sys\windows\com.d  src\core\sys\windows\comcat.d  src\core\sys\windows\commctrl.d  src\core\sys\windows\commdlg.d  src\core\sys\windows\core.d  src\core\sys\windows\cpl.d  src\core\sys\windows\cplext.d  src\core\sys\windows\custcntl.d  src\core\sys\windows\dbghelp.d  src\core\sys\windows\dbghelp_types.d  src\core\sys\windows\dbt.d  src\core\sys\windows\dde.d  src\core\sys\windows\ddeml.d  src\core\sys\windows\dhcpcsdk.d  src\core\sys\windows\dlgs.d  src\core\sys\windows\dll.d  src\core\sys\windows\docobj.d  src\core\sys\windows\errorrep.d  src\core\sys\windows\exdisp.d  src\core\sys\windows\exdispid.d  src\core\sys\windows\httpext.d  src\core\sys\windows\idispids.d  src\core\sys\windows\imagehlp.d  src\core\sys\windows\imm.d  src\core\sys\windows\intshcut.d  src\core\sys\windows\ipexport.d  src\core\sys\windows\iphlpapi.d  src\core\sys\windows\ipifcons.d  src\core\sys\windows\iprtrmib.d  src\core\sys\windows\iptypes.d  src\core\sys\windows\isguids.d  src\core\sys\windows\lm.d  src\core\sys\windows\lmaccess.d  src\core\sys\windows\lmalert.d  src\core\sys\windows\lmapibuf.d  src\core\sys\windows\lmat.d  src\core\sys\windows\lmaudit.d  src\core\sys\windows\lmbrowsr.d  src\core\sys\windows\lmchdev.d  src\core\sys\windows\lmconfig.d  src\core\sys\windows\lmcons.d  src\core\sys\windows\lmerr.d  src\core\sys\windows\lmerrlog.d  src\core\sys\windows\lmmsg.d  src\core\sys\windows\lmremutl.d  src\core\sys\windows\lmrepl.d  src\core\sys\windows\lmserver.d  src\core\sys\windows\lmshare.d  src\core\sys\windows\lmsname.d  src\core\sys\windows\lmstats.d  src\core\sys\windows\lmsvc.d  src\core\sys\windows\lmuse.d  src\core\sys\windows\lmuseflg.d  src\core\sys\windows\lmwksta.d  src\core\sys\windows\lzexpand.d  src\core\sys\windows\mapi.d  src\core\sys\windows\mciavi.d  src\core\sys\windows\mcx.d  src\core\sys\windows\mgmtapi.d  src\core\sys\windows\mmsystem.d  src\core\sys\windows\msacm.d  src\core\sys\windows\mshtml.d  src\core\sys\windows\mswsock.d  src\core\sys\windows\nb30.d  src\core\sys\windows\nddeapi.d  src\core\sys\windows\nspapi.d  src\core\sys\windows\ntdef.d  src\core\sys\windows\ntdll.d  src\core\sys\windows\ntldap.d  src\core\sys\windows\ntsecapi.d  src\core\sys\windows\ntsecpkg.d  src\core\sys\windows\oaidl.d  src\core\sys\windows\objbase.d  src\core\sys\windows\objfwd.d  src\core\sys\windows\objidl.d  src\core\sys\windows\objsafe.d  src\core\sys\windows\ocidl.d  src\core\sys\windows\odbcinst.d  src\core\sys\windows\ole.d  src\core\sys\windows\ole2.d  src\core\sys\windows\ole2ver.d  src\core\sys\windows\oleacc.d  src\core\sys\windows\oleauto.d  src\core\sys\windows\olectl.d  src\core\sys\windows\olectlid.d  src\core\sys\windows\oledlg.d  src\core\sys\windows\oleidl.d  src\core\sys\windows\pbt.d  src\core\sys\windows\powrprof.d  src\core\sys\windows\prsht.d  src\core\sys\windows\psapi.d  src\core\sys\windows\rapi.d  src\core\sys\windows\ras.d  src\core\sys\windows\rasdlg.d  src\core\sys\windows\raserror.d  src\core\sys\windows\rassapi.d  src\core\sys\windows\reason.d  src\core\sys\windows\regstr.d  src\core\sys\windows\richedit.d  src\core\sys\windows\richole.d  src\core\sys\windows\rpc.d  src\core\sys\windows\rpcdce.d  src\core\sys\windows\rpcdce2.d  src\core\sys\windows\rpcdcep.d  src\core\sys\windows\rpcndr.d  src\core\sys\windows\rpcnsi.d  src\core\sys\windows\rpcnsip.d  src\core\sys\windows\rpcnterr.d  src\core\sys\windows\schannel.d  src\core\sys\windows\sdkddkver.d  src\core\sys\windows\secext.d  src\core\sys\windows\security.d  src\core\sys\windows\servprov.d  src\core\sys\windows\setupapi.d  src\core\sys\windows\shellapi.d  src\core\sys\windows\shldisp.d  src\core\sys\windows\shlguid.d  src\core\sys\windows\shlobj.d  src\core\sys\windows\shlwapi.d  src\core\sys\windows\snmp.d  src\core\sys\windows\sql.d  src\core\sys\windows\sqlext.d  src\core\sys\windows\sqltypes.d  src\core\sys\windows\sqlucode.d  src\core\sys\windows\sspi.d  src\core\sys\windows\stacktrace.d  src\core\sys\windows\stat.d  src\core\sys\windows\stdc\time.d  src\core\sys\windows\subauth.d  src\core\sys\windows\threadaux.d  src\core\sys\windows\tlhelp32.d  src\core\sys\windows\tmschema.d  src\core\sys\windows\unknwn.d  src\core\sys\windows\uuid.d  src\core\sys\windows\vfw.d  src\core\sys\windows\w32api.d  src\core\sys\windows\winbase.d  src\core\sys\windows\winber.d  src\core\sys\windows\wincon.d  src\core\sys\windows\wincrypt.d  src\core\sys\windows\windef.d  src\core\sys\windows\windows.d  src\core\sys\windows\winerror.d  src\core\sys\windows\wingdi.d  src\core\sys\windows\winhttp.d  src\core\sys\windows\wininet.d  src\core\sys\windows\winioctl.d  src\core\sys\windows\winldap.d  src\core\sys\windows\winnetwk.d  src\core\sys\windows\winnls.d  src\core\sys\windows\winnt.d  src\core\sys\windows\winperf.d  src\core\sys\windows\winreg.d  src\core\sys\windows\winsock2.d  src\core\sys\windows\winspool.d  src\core\sys\windows\winsvc.d  src\core\sys\windows\winuser.d  src\core\sys\windows\winver.d  src\core\sys\windows\wtsapi32.d  src\core\sys\windows\wtypes.d   src\core\thread\fiber.d  src\core\thread\types.d  src\core\thread\threadgroup.d  src\core\thread\threadbase.d  src\core\thread\osthread.d  src\core\thread\context.d  src\core\thread\package.d   src\gc\bits.d  src\gc\impl\conservative\gc.d  src\gc\os.d  src\gc\pooltable.d  src\gc\proxy.d  src\gc\impl\manual\gc.d  src\gc\impl\proto\gc.d   src\rt\aApply.d  src\rt\aApplyR.d  src\rt\aaA.d  src\rt\adi.d  src\rt\alloca.d  src\rt\arrayassign.d  src\rt\arraycat.d  src\rt\cast_.d  src\rt\cmath2.d  src\rt\config.d  src\rt\cover.d  src\rt\critical_.d  src\rt\deh.d  src\rt\deh_win32.d  src\rt\deh_win64_posix.d  src\rt\dmain2.d  src\rt\dwarfeh.d  src\rt\ehalloc.d  src\rt\invariant.d  src\rt\lifetime.d  src\rt\llmath.d  src\rt\memory.d  src\rt\memset.d  src\rt\minfo.d  src\rt\monitor_.d  src\rt\msvc.d  src\rt\msvc_math.d  src\rt\profilegc.d  src\rt\qsort.d  src\rt\sections.d  src\rt\sections_android.d  src\rt\sections_darwin_64.d  src\rt\sections_elf_shared.d  src\rt\sections_osx_x86.d  src\rt\sections_osx_x86_64.d  src\rt\sections_solaris.d  src\rt\sections_win32.d  src\rt\sections_win64.d  src\rt\tlsgc.d  src\rt\trace.d  src\rt\tracegc.d  src\rt\unwind.d   src\rt\backtrace\dwarf.d  src\rt\backtrace\elf.d  src\rt\backtrace\macho.d   src\rt\util\random.d  src\rt\util\typeinfo.d  src\rt\util\utility.d  src\rt\util\container\array.d  src\rt\util\container\common.d  src\rt\util\container\hashtab.d  src\rt\util\container\treap.d   src\etc\linux\memoryerror.d lib\druntime32mscoff.lib -debuglib=lib\druntime32mscoff.lib -defaultlib=lib\druntime32mscoff.lib user32.lib
src\core\sys\windows\odbcinst.d(158): Deprecation: function `core.sys.windows.odbcinst.SQLInstallTranslatorW` is deprecated - Use SQLInstallTranslatorExW instead
src\core\sys\windows\odbcinst.d(158): Deprecation: function `core.sys.windows.odbcinst.SQLInstallTranslatorW` is deprecated - Use SQLInstallTranslatorExW instead
src\core\internal\dassert.d(143): Deprecation: argument `cast(__c_long_double)v` for format specification `"%Lg"` must be `real`, not `double`
src\core\internal\dassert.d(157): Deprecation: argument `cast(idouble)v` for format specification `"%Lg"` must be `real`, not `idouble`
src\core\internal\dassert.d(147): Deprecation: argument `cast(__c_long_double)cast(real)v` for format specification `"%Lg"` must be `real`, not `double`
src\core\internal\dassert.d(147): Deprecation: argument `cast(__c_long_double)cast(ireal)v` for format specification `"%Lg"` must be `real`, not `double`

unittest
Error: 'unittest' not found
##[error]Cmd.exe exited with code '3'.

I find this baffling.

@UplinkCoder
Copy link
Member

Azure pipelines (Windows_LDC_MinGW win32-ldc):

D:\a\1\druntime>echo "[DRUNTIME] running tests..." 
"[DRUNTIME] running tests..."

D:\a\1\druntime>"D:\a\1\s\dm\path\make.exe" -f win64.mak MODEL=32mscoff "DMD=D:\a\1\s\generated\Windows\RelWithAsserts\Win32\dmd.exe" "VCDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\." "CC=C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\cl.exe " "MAKE=D:\a\1\s\dm\path\make.exe" unittest   || exit /B 3 
"D:\a\1\s\generated\Windows\RelWithAsserts\Win32\dmd.exe" -m32mscoff -conf= -O -release -dip1000 -preview=fieldwise -w -version=_MSC_VER_ -Isrc -Iimport -version=druntime_unittest -version=CoreUnittest -unittest -checkaction=context -ofunittest.exe -main src\object.d   src\core\atomic.d  src\core\attribute.d  src\core\bitop.d  src\core\checkedint.d  src\core\cpuid.d  src\core\demangle.d  src\core\exception.d  src\core\lifetime.d  src\core\math.d  src\core\memory.d  src\core\runtime.d  src\core\simd.d  src\core\time.d  src\core\vararg.d  src\core\volatile.d   src\core\gc\config.d  src\core\gc\gcinterface.d  src\core\gc\registry.d   src\core\internal\abort.d  src\core\internal\atomic.d  src\core\internal\attributes.d  src\core\internal\convert.d  src\core\internal\dassert.d  src\core\internal\destruction.d  src\core\internal\entrypoint.d  src\core\internal\execinfo.d  src\core\internal\hash.d  src\core\internal\moving.d  src\core\internal\parseoptions.d  src\core\internal\postblit.d  src\core\internal\spinlock.d  src\core\internal\string.d  src\core\internal\switch_.d  src\core\internal\traits.d  src\core\internal\utf.d  src\core\internal\lifetime.d   src\core\internal\array\appending.d  src\core\internal\array\comparison.d  src\core\internal\array\construction.d  src\core\internal\array\equality.d  src\core\internal\array\casting.d  src\core\internal\array\capacity.d  src\core\internal\array\concatenation.d  src\core\internal\array\operations.d  src\core\internal\array\utils.d   src\core\internal\elf\dl.d  src\core\internal\elf\io.d   src\core\internal\util\array.d   src\core\internal\vararg\aarch64.d  src\core\internal\vararg\sysv_x64.d   src\core\stdc\assert_.d  src\core\stdc\complex.d  src\core\stdc\config.d  src\core\stdc\ctype.d  src\core\stdc\errno.d  src\core\stdc\fenv.d  src\core\stdc\float_.d  src\core\stdc\inttypes.d  src\core\stdc\limits.d  src\core\stdc\locale.d  src\core\stdc\math.d  src\core\stdc\signal.d  src\core\stdc\stdarg.d  src\core\stdc\stddef.d  src\core\stdc\stdint.d  src\core\stdc\stdio.d  src\core\stdc\stdlib.d  src\core\stdc\string.d  src\core\stdc\tgmath.d  src\core\stdc\time.d  src\core\stdc\wchar_.d  src\core\stdc\wctype.d   src\core\stdcpp\allocator.d  src\core\stdcpp\array.d  src\core\stdcpp\exception.d  src\core\stdcpp\memory.d  src\core\stdcpp\new_.d  src\core\stdcpp\string.d  src\core\stdcpp\string_view.d  src\core\stdcpp\type_traits.d  src\core\stdcpp\utility.d  src\core\stdcpp\vector.d  src\core\stdcpp\xutility.d   src\core\sync\barrier.d  src\core\sync\condition.d  src\core\sync\config.d  src\core\sync\exception.d  src\core\sync\event.d  src\core\sync\mutex.d  src\core\sync\rwmutex.d  src\core\sync\semaphore.d   src\core\sys\bionic\err.d  src\core\sys\bionic\fcntl.d  src\core\sys\bionic\string.d  src\core\sys\bionic\unistd.d   src\core\sys\darwin\crt_externs.d  src\core\sys\darwin\dlfcn.d  src\core\sys\darwin\err.d  src\core\sys\darwin\execinfo.d  src\core\sys\darwin\pthread.d  src\core\sys\darwin\string.d  src\core\sys\darwin\mach\dyld.d  src\core\sys\darwin\mach\getsect.d  src\core\sys\darwin\mach\kern_return.d  src\core\sys\darwin\mach\loader.d  src\core\sys\darwin\mach\nlist.d  src\core\sys\darwin\mach\port.d  src\core\sys\darwin\mach\semaphore.d  src\core\sys\darwin\mach\stab.d  src\core\sys\darwin\mach\thread_act.d  src\core\sys\darwin\netinet\in_.d   src\core\sys\darwin\sys\cdefs.d  src\core\sys\darwin\sys\event.d  src\core\sys\darwin\sys\mman.d   src\core\sys\freebsd\dlfcn.d  src\core\sys\freebsd\err.d  src\core\sys\freebsd\execinfo.d  src\core\sys\freebsd\netinet\in_.d  src\core\sys\freebsd\pthread_np.d  src\core\sys\freebsd\string.d  src\core\sys\freebsd\time.d  src\core\sys\freebsd\unistd.d   src\core\sys\freebsd\sys\_bitset.d  src\core\sys\freebsd\sys\_cpuset.d  src\core\sys\freebsd\sys\cdefs.d  src\core\sys\freebsd\sys\elf_common.d  src\core\sys\freebsd\sys\elf.d  src\core\sys\freebsd\sys\elf32.d  src\core\sys\freebsd\sys\elf64.d  src\core\sys\freebsd\sys\event.d  src\core\sys\freebsd\sys\link_elf.d  src\core\sys\freebsd\sys\mman.d  src\core\sys\freebsd\sys\mount.d   src\core\sys\dragonflybsd\dlfcn.d  src\core\sys\dragonflybsd\err.d  src\core\sys\dragonflybsd\execinfo.d  src\core\sys\dragonflybsd\netinet\in_.d  src\core\sys\dragonflybsd\pthread_np.d  src\core\sys\dragonflybsd\string.d  src\core\sys\dragonflybsd\time.d   src\core\sys\dragonflybsd\sys\_bitset.d  src\core\sys\dragonflybsd\sys\_cpuset.d  src\core\sys\dragonflybsd\sys\cdefs.d  src\core\sys\dragonflybsd\sys\elf.d  src\core\sys\dragonflybsd\sys\elf32.d  src\core\sys\dragonflybsd\sys\elf64.d  src\core\sys\dragonflybsd\sys\elf_common.d  src\core\sys\dragonflybsd\sys\event.d  src\core\sys\dragonflybsd\sys\link_elf.d  src\core\sys\dragonflybsd\sys\mman.d  src\core\sys\dragonflybsd\sys\socket.d   src\core\sys\linux\config.d  src\core\sys\linux\dlfcn.d  src\core\sys\linux\elf.d  src\core\sys\linux\epoll.d  src\core\sys\linux\err.d  src\core\sys\linux\errno.d  src\core\sys\linux\execinfo.d  src\core\sys\linux\fcntl.d  src\core\sys\linux\ifaddrs.d  src\core\sys\linux\link.d  src\core\sys\linux\sched.d  src\core\sys\linux\stdio.d  src\core\sys\linux\string.d  src\core\sys\linux\termios.d  src\core\sys\linux\time.d  src\core\sys\linux\timerfd.d  src\core\sys\linux\tipc.d  src\core\sys\linux\unistd.d   src\core\sys\linux\netinet\in_.d  src\core\sys\linux\netinet\tcp.d   src\core\sys\linux\sys\auxv.d  src\core\sys\linux\sys\eventfd.d  src\core\sys\linux\sys\file.d  src\core\sys\linux\sys\inotify.d  src\core\sys\linux\sys\mman.d  src\core\sys\linux\sys\signalfd.d  src\core\sys\linux\sys\socket.d  src\core\sys\linux\sys\sysinfo.d  src\core\sys\linux\sys\xattr.d  src\core\sys\linux\sys\time.d  src\core\sys\linux\sys\prctl.d   src\core\sys\netbsd\dlfcn.d  src\core\sys\netbsd\err.d  src\core\sys\netbsd\execinfo.d  src\core\sys\netbsd\string.d  src\core\sys\netbsd\time.d   src\core\sys\netbsd\sys\elf.d  src\core\sys\netbsd\sys\elf32.d  src\core\sys\netbsd\sys\elf64.d  src\core\sys\netbsd\sys\elf_common.d  src\core\sys\netbsd\sys\event.d  src\core\sys\netbsd\sys\featuretest.d  src\core\sys\netbsd\sys\link_elf.d  src\core\sys\netbsd\sys\mman.d   src\core\sys\openbsd\dlfcn.d  src\core\sys\openbsd\err.d  src\core\sys\openbsd\string.d  src\core\sys\openbsd\time.d   src\core\sys\openbsd\sys\cdefs.d  src\core\sys\openbsd\sys\elf.d  src\core\sys\openbsd\sys\elf32.d  src\core\sys\openbsd\sys\elf64.d  src\core\sys\openbsd\sys\elf_common.d  src\core\sys\openbsd\sys\link_elf.d  src\core\sys\openbsd\sys\mman.d   src\core\sys\posix\arpa\inet.d  src\core\sys\posix\aio.d  src\core\sys\posix\config.d  src\core\sys\posix\dirent.d  src\core\sys\posix\dlfcn.d  src\core\sys\posix\fcntl.d  src\core\sys\posix\grp.d  src\core\sys\posix\iconv.d  src\core\sys\posix\inttypes.d  src\core\sys\posix\libgen.d  src\core\sys\posix\locale.d  src\core\sys\posix\mqueue.d  src\core\sys\posix\netdb.d  src\core\sys\posix\poll.d  src\core\sys\posix\pthread.d  src\core\sys\posix\pwd.d  src\core\sys\posix\sched.d  src\core\sys\posix\semaphore.d  src\core\sys\posix\setjmp.d  src\core\sys\posix\signal.d  src\core\sys\posix\spawn.d  src\core\sys\posix\stdio.d  src\core\sys\posix\stdlib.d  src\core\sys\posix\string.d  src\core\sys\posix\strings.d  src\core\sys\posix\syslog.d  src\core\sys\posix\termios.d  src\core\sys\posix\time.d  src\core\sys\posix\ucontext.d  src\core\sys\posix\unistd.d  src\core\sys\posix\utime.d   src\core\sys\posix\net\if_.d   src\core\sys\posix\netinet\in_.d  src\core\sys\posix\netinet\tcp.d   src\core\sys\posix\stdc\time.d   src\core\sys\posix\sys\filio.d  src\core\sys\posix\sys\ioccom.d  src\core\sys\posix\sys\ioctl.d  src\core\sys\posix\sys\ipc.d  src\core\sys\posix\sys\mman.d  src\core\sys\posix\sys\msg.d  src\core\sys\posix\sys\resource.d  src\core\sys\posix\sys\select.d  src\core\sys\posix\sys\shm.d  src\core\sys\posix\sys\socket.d  src\core\sys\posix\sys\stat.d  src\core\sys\posix\sys\statvfs.d  src\core\sys\posix\sys\time.d  src\core\sys\posix\sys\ttycom.d  src\core\sys\posix\sys\types.d  src\core\sys\posix\sys\uio.d  src\core\sys\posix\sys\un.d  src\core\sys\posix\sys\utsname.d  src\core\sys\posix\sys\wait.d   src\core\sys\solaris\dlfcn.d  src\core\sys\solaris\elf.d  src\core\sys\solaris\err.d  src\core\sys\solaris\execinfo.d  src\core\sys\solaris\libelf.d  src\core\sys\solaris\link.d  src\core\sys\solaris\time.d  src\core\sys\solaris\sys\elf.d  src\core\sys\solaris\sys\elf_386.d  src\core\sys\solaris\sys\elf_amd64.d  src\core\sys\solaris\sys\elf_notes.d  src\core\sys\solaris\sys\elf_SPARC.d  src\core\sys\solaris\sys\elftypes.d  src\core\sys\solaris\sys\link.d  src\core\sys\solaris\sys\priocntl.d  src\core\sys\solaris\sys\procset.d  src\core\sys\solaris\sys\types.d   src\core\sys\windows\accctrl.d  src\core\sys\windows\aclapi.d  src\core\sys\windows\aclui.d  src\core\sys\windows\basetsd.d  src\core\sys\windows\basetyps.d  src\core\sys\windows\cderr.d  src\core\sys\windows\cguid.d  src\core\sys\windows\com.d  src\core\sys\windows\comcat.d  src\core\sys\windows\commctrl.d  src\core\sys\windows\commdlg.d  src\core\sys\windows\core.d  src\core\sys\windows\cpl.d  src\core\sys\windows\cplext.d  src\core\sys\windows\custcntl.d  src\core\sys\windows\dbghelp.d  src\core\sys\windows\dbghelp_types.d  src\core\sys\windows\dbt.d  src\core\sys\windows\dde.d  src\core\sys\windows\ddeml.d  src\core\sys\windows\dhcpcsdk.d  src\core\sys\windows\dlgs.d  src\core\sys\windows\dll.d  src\core\sys\windows\docobj.d  src\core\sys\windows\errorrep.d  src\core\sys\windows\exdisp.d  src\core\sys\windows\exdispid.d  src\core\sys\windows\httpext.d  src\core\sys\windows\idispids.d  src\core\sys\windows\imagehlp.d  src\core\sys\windows\imm.d  src\core\sys\windows\intshcut.d  src\core\sys\windows\ipexport.d  src\core\sys\windows\iphlpapi.d  src\core\sys\windows\ipifcons.d  src\core\sys\windows\iprtrmib.d  src\core\sys\windows\iptypes.d  src\core\sys\windows\isguids.d  src\core\sys\windows\lm.d  src\core\sys\windows\lmaccess.d  src\core\sys\windows\lmalert.d  src\core\sys\windows\lmapibuf.d  src\core\sys\windows\lmat.d  src\core\sys\windows\lmaudit.d  src\core\sys\windows\lmbrowsr.d  src\core\sys\windows\lmchdev.d  src\core\sys\windows\lmconfig.d  src\core\sys\windows\lmcons.d  src\core\sys\windows\lmerr.d  src\core\sys\windows\lmerrlog.d  src\core\sys\windows\lmmsg.d  src\core\sys\windows\lmremutl.d  src\core\sys\windows\lmrepl.d  src\core\sys\windows\lmserver.d  src\core\sys\windows\lmshare.d  src\core\sys\windows\lmsname.d  src\core\sys\windows\lmstats.d  src\core\sys\windows\lmsvc.d  src\core\sys\windows\lmuse.d  src\core\sys\windows\lmuseflg.d  src\core\sys\windows\lmwksta.d  src\core\sys\windows\lzexpand.d  src\core\sys\windows\mapi.d  src\core\sys\windows\mciavi.d  src\core\sys\windows\mcx.d  src\core\sys\windows\mgmtapi.d  src\core\sys\windows\mmsystem.d  src\core\sys\windows\msacm.d  src\core\sys\windows\mshtml.d  src\core\sys\windows\mswsock.d  src\core\sys\windows\nb30.d  src\core\sys\windows\nddeapi.d  src\core\sys\windows\nspapi.d  src\core\sys\windows\ntdef.d  src\core\sys\windows\ntdll.d  src\core\sys\windows\ntldap.d  src\core\sys\windows\ntsecapi.d  src\core\sys\windows\ntsecpkg.d  src\core\sys\windows\oaidl.d  src\core\sys\windows\objbase.d  src\core\sys\windows\objfwd.d  src\core\sys\windows\objidl.d  src\core\sys\windows\objsafe.d  src\core\sys\windows\ocidl.d  src\core\sys\windows\odbcinst.d  src\core\sys\windows\ole.d  src\core\sys\windows\ole2.d  src\core\sys\windows\ole2ver.d  src\core\sys\windows\oleacc.d  src\core\sys\windows\oleauto.d  src\core\sys\windows\olectl.d  src\core\sys\windows\olectlid.d  src\core\sys\windows\oledlg.d  src\core\sys\windows\oleidl.d  src\core\sys\windows\pbt.d  src\core\sys\windows\powrprof.d  src\core\sys\windows\prsht.d  src\core\sys\windows\psapi.d  src\core\sys\windows\rapi.d  src\core\sys\windows\ras.d  src\core\sys\windows\rasdlg.d  src\core\sys\windows\raserror.d  src\core\sys\windows\rassapi.d  src\core\sys\windows\reason.d  src\core\sys\windows\regstr.d  src\core\sys\windows\richedit.d  src\core\sys\windows\richole.d  src\core\sys\windows\rpc.d  src\core\sys\windows\rpcdce.d  src\core\sys\windows\rpcdce2.d  src\core\sys\windows\rpcdcep.d  src\core\sys\windows\rpcndr.d  src\core\sys\windows\rpcnsi.d  src\core\sys\windows\rpcnsip.d  src\core\sys\windows\rpcnterr.d  src\core\sys\windows\schannel.d  src\core\sys\windows\sdkddkver.d  src\core\sys\windows\secext.d  src\core\sys\windows\security.d  src\core\sys\windows\servprov.d  src\core\sys\windows\setupapi.d  src\core\sys\windows\shellapi.d  src\core\sys\windows\shldisp.d  src\core\sys\windows\shlguid.d  src\core\sys\windows\shlobj.d  src\core\sys\windows\shlwapi.d  src\core\sys\windows\snmp.d  src\core\sys\windows\sql.d  src\core\sys\windows\sqlext.d  src\core\sys\windows\sqltypes.d  src\core\sys\windows\sqlucode.d  src\core\sys\windows\sspi.d  src\core\sys\windows\stacktrace.d  src\core\sys\windows\stat.d  src\core\sys\windows\stdc\time.d  src\core\sys\windows\subauth.d  src\core\sys\windows\threadaux.d  src\core\sys\windows\tlhelp32.d  src\core\sys\windows\tmschema.d  src\core\sys\windows\unknwn.d  src\core\sys\windows\uuid.d  src\core\sys\windows\vfw.d  src\core\sys\windows\w32api.d  src\core\sys\windows\winbase.d  src\core\sys\windows\winber.d  src\core\sys\windows\wincon.d  src\core\sys\windows\wincrypt.d  src\core\sys\windows\windef.d  src\core\sys\windows\windows.d  src\core\sys\windows\winerror.d  src\core\sys\windows\wingdi.d  src\core\sys\windows\winhttp.d  src\core\sys\windows\wininet.d  src\core\sys\windows\winioctl.d  src\core\sys\windows\winldap.d  src\core\sys\windows\winnetwk.d  src\core\sys\windows\winnls.d  src\core\sys\windows\winnt.d  src\core\sys\windows\winperf.d  src\core\sys\windows\winreg.d  src\core\sys\windows\winsock2.d  src\core\sys\windows\winspool.d  src\core\sys\windows\winsvc.d  src\core\sys\windows\winuser.d  src\core\sys\windows\winver.d  src\core\sys\windows\wtsapi32.d  src\core\sys\windows\wtypes.d   src\core\thread\fiber.d  src\core\thread\types.d  src\core\thread\threadgroup.d  src\core\thread\threadbase.d  src\core\thread\osthread.d  src\core\thread\context.d  src\core\thread\package.d   src\gc\bits.d  src\gc\impl\conservative\gc.d  src\gc\os.d  src\gc\pooltable.d  src\gc\proxy.d  src\gc\impl\manual\gc.d  src\gc\impl\proto\gc.d   src\rt\aApply.d  src\rt\aApplyR.d  src\rt\aaA.d  src\rt\adi.d  src\rt\alloca.d  src\rt\arrayassign.d  src\rt\arraycat.d  src\rt\cast_.d  src\rt\cmath2.d  src\rt\config.d  src\rt\cover.d  src\rt\critical_.d  src\rt\deh.d  src\rt\deh_win32.d  src\rt\deh_win64_posix.d  src\rt\dmain2.d  src\rt\dwarfeh.d  src\rt\ehalloc.d  src\rt\invariant.d  src\rt\lifetime.d  src\rt\llmath.d  src\rt\memory.d  src\rt\memset.d  src\rt\minfo.d  src\rt\monitor_.d  src\rt\msvc.d  src\rt\msvc_math.d  src\rt\profilegc.d  src\rt\qsort.d  src\rt\sections.d  src\rt\sections_android.d  src\rt\sections_darwin_64.d  src\rt\sections_elf_shared.d  src\rt\sections_osx_x86.d  src\rt\sections_osx_x86_64.d  src\rt\sections_solaris.d  src\rt\sections_win32.d  src\rt\sections_win64.d  src\rt\tlsgc.d  src\rt\trace.d  src\rt\tracegc.d  src\rt\unwind.d   src\rt\backtrace\dwarf.d  src\rt\backtrace\elf.d  src\rt\backtrace\macho.d   src\rt\util\random.d  src\rt\util\typeinfo.d  src\rt\util\utility.d  src\rt\util\container\array.d  src\rt\util\container\common.d  src\rt\util\container\hashtab.d  src\rt\util\container\treap.d   src\etc\linux\memoryerror.d lib\druntime32mscoff.lib -debuglib=lib\druntime32mscoff.lib -defaultlib=lib\druntime32mscoff.lib user32.lib
src\core\sys\windows\odbcinst.d(158): Deprecation: function `core.sys.windows.odbcinst.SQLInstallTranslatorW` is deprecated - Use SQLInstallTranslatorExW instead
src\core\sys\windows\odbcinst.d(158): Deprecation: function `core.sys.windows.odbcinst.SQLInstallTranslatorW` is deprecated - Use SQLInstallTranslatorExW instead
src\core\internal\dassert.d(143): Deprecation: argument `cast(__c_long_double)v` for format specification `"%Lg"` must be `real`, not `double`
src\core\internal\dassert.d(157): Deprecation: argument `cast(idouble)v` for format specification `"%Lg"` must be `real`, not `idouble`
src\core\internal\dassert.d(147): Deprecation: argument `cast(__c_long_double)cast(real)v` for format specification `"%Lg"` must be `real`, not `double`
src\core\internal\dassert.d(147): Deprecation: argument `cast(__c_long_double)cast(ireal)v` for format specification `"%Lg"` must be `real`, not `double`

unittest
Error: 'unittest' not found
##[error]Cmd.exe exited with code '3'.

I find this baffling.

It's your make ;)

@UplinkCoder
Copy link
Member

UplinkCoder commented Oct 10, 2020

@UplinkCoder please provide a link to your description of type functions, and a link to your implementation code, and I will be happy to cite them as prior work.

The implementation is here:
master...UplinkCoder:talias_master

The spec is still upcoming.
I have not figured all the corner cases, out yet.
What happens when you return the empty type, from a regular function, should that be an error?
And things like that...

I can write a preliminary description though.
I do believe that the performance of type functions will outperform AliasAssign
But I still have to benchmark.

  • Introduce __type which is the type of types.
    • this implies the type of any type is __type e.g. typeof(int) == __type
  • All types implicitly convert to __type.
  • Therefore types can be assigned to variables of type __type.
  • __type variables can only be accessed at CTFE.
  • similarly functions which take or return __type parameters or types derived thereof of such string[__type] can only be used at CTFE.
  • a runtime version cannot be emitted as that would require serializing the type-environment.
  • type.init is which is the empty type and denotes that a type variable has not been given a value, this is so we don't confuse it with a variable holding void or it is the null of types so to speak.
  • __traits and properties on type variables behave as if the type the variable contains had been written.
    i.e. int.max == (__type t = int, t.max);

And that's it.
Everything else just works as expected.

@andralex
Copy link
Member

Nice. Not much time to look into this, but a few concerns. I'm trying to convince myself that this is removal of surprising limitations, as opposed to a large change.

On the face of it, allowing reassignment of alias names is in keeping with the rest of D (mutability is the default). So I could imagine how we can consider that as removing a limitation.

However, there are other things that D users expect. The problem is, as @pbackus noted, order dependency. Consider this code:

alias X = int;
void f(X);
X = float;
void f(X);

AFAIU this will compile into declarations f(int) and f(double) being introduced. This has two problems:

  • It goes against a long-standing stance that D had that order of declarations is not important. (Per @pbackus, that was actually incorrect anyway but only in a few select cases - do we want more of those?)
  • It has smell even if we DO accept that order of declarations is important. It's just not good PL design to introduce such sequencing.
  • More complex examples could make it more difficult to figure out what happens, which is the classic argument people have against mutability.

I think it would make sense to disallow reassigning an alias as soon as it's been "read", i.e. used in another declaration:

alias X = void;
void f(); // and other lines that don't use X
X = int; // fine, reassign before use
void f(X); // BAM! X has been used and is now "frozen"
X = float; // ERROR! Attempt to assign after use
void f(X); // won't get here

That way (at least in such simple cases) the semantics of X does not depend on where it is being used. Yet, changing X and even writing a loop that computes it incrementally work just fine because you don't "escape" the alias while it's being computed.

@WalterBright
Copy link
Member Author

it would make sense to disallow reassigning an alias as soon as it's been "read"

The difficulty with that is iteration such as from the example:

template staticMap(F, T...)
{
    alias A = AliasSeq!();
    static foreach (t; T)
	A = AliasSeq!(A, F!t); // alias assignment here
    alias staticMap = A;
}

Note the use of A before it is reassigned.

@WalterBright
Copy link
Member Author

@atilaneves The main issue with this PR is that I can't yet measure its impact on compile-time performance because this version of staticMap isn't a drop-in replacement for the one in Phobos. If one replaces that, the Phobos test suite fails to compile.

The trouble is that this AliasAssign only allows for assigning types to an alias. AliasDeclarations allow types and symbols to be aliased, hence the failures in the std.meta unittests. It's not a problem adding this code, except that this PR is already 440 lines and is getting fairly hard to review because of its size. Adding the symbol support is adding a lot of code. It would be much better to add the symbol support in a followup PR.

@atilaneves atilaneves merged commit 97aa2ae into dlang:master Dec 14, 2020
@Geod24
Copy link
Member

Geod24 commented Dec 14, 2020

Where's the spec PR ?

@ibuclaw
Copy link
Member

ibuclaw commented Dec 14, 2020

Who approved this being merged?

@12345swordy
Copy link
Contributor

@atilaneves have approve this. Also, I concur @Geod24 response here, this needs a spec pr.

@WalterBright
Copy link
Member Author

spec pr

I'll add one, after I do the followup alias assign symbols. In the meantime, the changelog will do. BTW, could use some help on existing spec PRs.

@WalterBright WalterBright deleted the AliasAssign branch December 15, 2020 01:41
Copy link
Member

@Geod24 Geod24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SEGV the compiler:

import std.meta;

template Swap (alias A, alias B)
{
    alias C = A;
    B = A;
    A = B;
    enum Swap = true;
}

alias A = int;
alias B = string;

static assert(Swap!(A, B));

pragma(msg, A);


if (!aliassym.type)
{
ds.error("alias assignment can only apply to type aliases");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints:

test.d(9): Error: aliasAssign `test.staticMap!(Identity, int, string).__anonymous.__anonymous` alias assignment can only apply to type aliases

aliasAssign shouldn't be user-facing

}
if (!aliassymParent.isTemplateInstance())
{
ds.error("must be a member of a template");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this said "aliasAssign"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also triggers when using mixin template.


override const(char)* kind() const
{
return "aliasAssign";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"alias assignment"

@Geod24
Copy link
Member

Geod24 commented Dec 15, 2020

It would be great if we could stop putting experimental stuff straight into the language.
There's nothing wrong with iterative design and experimental features, but they should be opt-in, behind a preview switch.
Having it straight into the language means that code might not break when the feature is first added, but will break when the design evolves to incorporate feedback.

@ibuclaw
Copy link
Member

ibuclaw commented Dec 19, 2020

@atilaneves have approve this. Also, I concur @Geod24 response here, this needs a spec pr.

I'll ask again in a better way.

Who approved this to be merged when there are still outstanding reviews to be addressed, some of which highlight broken code?

@ibuclaw
Copy link
Member

ibuclaw commented Dec 19, 2020

(Yes, this change caused a build regression in master).

@atilaneves
Copy link
Contributor

@ibuclaw I missed the regression. How come CI didn't catch it?

This was approved in a "let's see where this goes" fashion and might be reverted.

@ibuclaw
Copy link
Member

ibuclaw commented Dec 24, 2020

How come CI didn't catch it?

It's not something that can really be tested unless you pull in building ldc/gdc bootstrap into the fold (not feasible due to time it takes). Though the auto-generated frontend.h header highlighted many additions that simply weren't added, or were added incorrectly to the headers used by gdc and ldc. I pointed some of these out as well in my review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments